package cn.iocoder.yudao.module.system.repository.mybatis.dao.notify;

import cn.iocoder.yudao.common.pojo.PageResult;
import cn.iocoder.yudao.core.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.core.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.repository.mybatis.domain.notify.NotifyTemplate;
import cn.iocoder.yudao.module.system.vo.notify.template.NotifyTemplatePageReqVO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface NotifyTemplateMapper extends BaseMapperX<NotifyTemplate> {

    default NotifyTemplate selectByCode(String code) {
        return selectOne(NotifyTemplate::getCode, code);
    }

    default PageResult<NotifyTemplate> selectPage(NotifyTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<NotifyTemplate>()
                .likeIfPresent(NotifyTemplate::getCode, reqVO.getCode())
                .likeIfPresent(NotifyTemplate::getName, reqVO.getName())
                .eqIfPresent(NotifyTemplate::getStatus, reqVO.getStatus())
                .betweenIfPresent(NotifyTemplate::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(NotifyTemplate::getId));
    }

}
